<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" import="java.util.*,org.springframework.web.servlet.i18n.SessionLocaleResolver" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@	taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<meta name="decorator" content="plain" />
<style type="text/css">
body {
	padding-top: 40px;
	padding-bottom: 40px;
}

.form-signin {
	background: none repeat scroll 0 0 #FFFFFF;
	border-bottom: 1px solid rgba(0, 0, 0, 0.18);
	border-radius: 2px 2px 2px 2px;
	padding: 9px 29px 29px 29px;
	box-shadow: 0 1px 6px #BBBBBB;
	-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
<c:if test="${empty param.loginerror}">
	margin-top: 57px;
</c:if>
}

.form-signin .form-signin-heading,.form-signin .checkbox {
	margin-bottom: 10px;
}

.form-signin input[type="text"],.form-signin input[type="password"] {
	font-size: 16px;
	height: auto;
	margin-bottom: 15px;
	padding: 7px 9px;
}

</style>
<title><spring:message code="text_usersignin" text="User Sign in" /></title>
</head>
<body>
	<div class="container">
		<div class="row">
			<div class="offset3 span6">
				<c:if test="${!empty param.loginerror}">
				<div class="alert alert-error">
			  		<strong>
			  			<spring:message code="message_error_incorrectemailpassword" text="Incorrect Email and password combination" />
			  		</strong>			  					  					  
		  		</div>	
				</c:if>
			</div>
		</div>
		<div class="row">
			<div class="offset4 span4">
				<form id="loginForm" action="<%=request.getContextPath()%>/processlogin"
					class="form-signin border-rounded" method="post">
					<h3 class="form-signin-heading">
						<spring:message code="text_pleasesignin" text="Please sign in" />
					</h3>
					<div class="control-group">
						<input type="text" name="email" class="input-block-level" value="${param.email}"
							placeholder="<spring:message code="text_emailaddress" text="Email address" />">
						<span class="help-block validation-failed"></span>
					</div>
					<div class="control-group">
						<input type="password" name="password" class="input-block-level"
							placeholder="<spring:message code="text_password" text="Password" />">
						<span class="help-block validation-failed"></span>
					</div>
					<label class="checkbox"> 
						<input type="checkbox" value="true" name="rememberme"> 
						<spring:message code="text_rememberme" text="Remember me" />
					</label>
					<button class="btn btn-block btn-primary" type="submit">
						<spring:message code="text_signin" text="Sign in" />						
					</button>
					<BR>
					<div class="pull-right">
						<a href="<%=request.getContextPath()%>/pages/signup">
							<spring:message code="text_signup" text="Sign Up" />
						</a>
						&nbsp;
						<a href="<%=request.getContextPath()%>">
							<spring:message code="text_homepage" text="Home" />
						</a>
					</div>					
				</form>
			</div>
		</div>	
	</div>
<script>
	$('#loginForm').validate({
		rules: {
			email: {
				required: true,
				email: true
			},
			password: {
				required: true
			}
		},
		messages: {
			email: {
				email: '<spring:message code="message_entervalidemailaddress" text="Please enter a valid email address." />',
				required: '<spring:message code="message_fieldrequired" text="This field is required." />'
			},
			password: {
				required: '<spring:message code="message_fieldrequired" text="This field is required." />'
			}
		}
	});
</script>
</body>
</html>